#include <copydir.h>
//统计文件夹中文件数量
void num_file(char *path, struct file_rate *filerate) {
	DIR *dir = opendir(path);
	struct dirent *entry;
	struct stat buf;
	if(dir != NULL) {
		while((entry = readdir(dir)) != NULL) {
			char pathname[D_SIZE];
			sprintf(pathname, "%s/%s", path, entry->d_name);
			if(!strcmp(entry->d_name,".")||!strcmp(entry->d_name,".."))
				continue;
			if(entry->d_type & DT_DIR)
				num_file(pathname,filerate);
			filerate->num++;
		}
	}
	FILE *f = fopen("./pro_copy.log","a+");
	time_t rawtime;
	struct tm *timeinfo;
	timeinfo = localtime(&rawtime);
	fprintf(f,"\007The current date/time is:%s\n",asctime(timeinfo));
	fprintf(f,"count file %s\n",path);
	fclose(f);
}
